import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'

const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
};
Vue.use(Router);

export default new Router({
  // mode: 'history', //去除#号，正式环境需求需配置nginx
  routes: [
    {
      path: '/',
      redirect: '/smart'
    },
    {
      path: '/mail',
      name: 'Mail',
      meta: {title: '通讯录'},
      component: resolve => require(['@/views/mail/index'], resolve),
    },
    {
      path: '/application',
      name: 'Application',
      meta: {title: '应用'},
      component: resolve => require(['@/views/application/index'], resolve),
      children:[
        {
          path: '/',
          redirect: '/application/transfer',
        },
        {
          path: 'transfer',
          name: 'Transfer',
          meta: {title: '一键移交'},
          component: resolve => require(['@/views/application/transfer'], resolve),
        },
      ]
    },
    {
      path: '/login',
      name: 'Login',
      meta: {title: '登录'},
      component: resolve => require(['@/views/login/index'], resolve),
    },
    {
      path: '/forgetPassword',
      name: 'ForgetPassword',
      meta: {title: '忘记密码'},
      component: resolve => require(['@/views/login/forgetPassword'], resolve),
    },
    {
      path: '/register',
      name: 'Register',
      meta: {title: '注册'},
      component: resolve => require(['@/views/register/index'], resolve),
      children: [
        {
          path: '/',
          redirect: 'RegisterType'
        },
        {
          path: 'registerType',
          name: 'RegisterType',
          meta: {title: '选择注册类型'},
          component: resolve => require(['@/views/register/registerType'], resolve)
        },
        {
          path: 'registerForm',
          name: 'RegisterForm',
          meta: {title: '填写资料'},
          component: resolve => require(['@/views/register/registerForm'], resolve)
        },
        {
          path: 'registerSuccess',
          name: 'RegisterSuccess',
          meta: {title: '注册成功'},
          component: resolve => require(['@/views/register/registerSuccess'], resolve)
        }
      ]
    },
    {
      path: '/project',
      name: 'Project',
      meta: {title: '项目'},
      component: resolve => require(['@/views/project/index'], resolve),
      children: [
        {
          path: '/',
          redirect: '/project/bulletinBoard',
          // name: 'BulletinBoard',
          // meta: {title: '项目看板'},
          // component: resolve => require(['@/views/project/bulletinBoard/index'], resolve)
        },
        {
          path: 'progress',
          name: 'Progress',
          meta: {title: '项目进度'},
          component: resolve => require(['@/views/project/progress'], resolve)
        },
        {
          path: 'bulletinBoard',
          name: 'BulletinBoard',
          meta: {title: '项目看板'},
          component: resolve => require(['@/views/project/bulletinBoard/index'], resolve)
        },
        {
          path: 'projectList',
          name: 'ProjectList',
          meta: {title: '项目列表'},
          component: resolve => require(['@/views/project/projectList/index'], resolve)
        },
        {
          path: 'dynamic',
          name: 'Dynamic',
          meta: {title: '项目动态'},
          component: resolve => require(['@/views/project/info/dynamic'], resolve)
        },
        {
          path: 'info',
          name: 'Info',
          meta: {title: '项目详情'},
          component: resolve => require(['@/views/project/info/index'], resolve),
        },
        {
          path: 'milepost',
          name: 'Milepost',
          meta: {title: '里程碑'},
          component: resolve => require(['@/views/project/milepost/index'], resolve),
        },
        {
          path: 'milepost2',
          name: 'Milepost2',
          meta: {title: '里程碑-模板',isRouter:true},
          component: resolve => require(['@/views/project/milepost/template'], resolve),
        },
        {
          path: 'member',
          name: 'Member',
          meta: {title: '项目成员'},
          component: resolve => require(['@/views/project/info/member'], resolve),
        },
        {
          path: 'course',
          name: 'Course',
          meta: {title: '精彩历程'},
          component: resolve => require(['@/views/project/info/course'], resolve),
        },
      ]
    },
    {
      path: '/task',
      name: 'Task',
      meta: {title: '任务管理'},
      component: resolve => require(['@/views/task/index'], resolve),
      children: [
        {
          path: '/',
          redirect: '/task/seeBoard',
        },
        {
          path: 'seeBoard',
          name: 'SeeBoard',
          meta: {title: '任务看板'},
          component: resolve => require(['@/views/task/seeBoard/index'], resolve),
        }, {
          path: 'delayApplyList',
          name: 'DelayApplyList',
          meta: {title: '我的延期申请'},
          component: resolve => require(['@/views/task/delayApplyList/index'], resolve),
        }, {
          path: 'taskSearch',
          name: 'TaskSearch',
          meta: {title: '任务搜索'},
          component: resolve => require(['@/views/task/search/index'], resolve),
        }
      ]
    },
    {
      path: '/smart',
      name: 'Smart',
      meta: {title: '小智分析'},
      component: resolve => require(['@/views/smart/index'], resolve),
      children: [
        {
          path: '/',
          redirect: '/smart/toDay',
        },
        {
          path: 'toDay',
          name: 'ToDay',
          meta: {title: '今日看板'},
          component: resolve => require(['@/views/smart/toDay/index'], resolve),
        },
        {
          path: 'projectTrend',
          name: 'ProjectTrend',
          meta: {title: '项目趋势'},
          component: resolve => require(['@/views/smart/projectTrend/index'], resolve),
        },
        {
          path: 'taskTrend',
          name: 'TaskTrend',
          meta: {title: '任务趋势'},
          component: resolve => require(['@/views/smart/taskTrend/index'], resolve),
        },
        {
          path: 'rankingList',
          name: 'RankingList',
          meta: {title: '排行榜'},
          component: resolve => require(['@/views/smart/rankingList/index'], resolve),
        },
        {
          path: 'staffHours',
          name: 'StaffHours',
          meta: {title: '人员工时'},
          component: resolve => require(['@/views/smart/staffHours/index'], resolve),
        },
        {
          path: 'workBriefing',
          name: 'WorkBriefing',
          meta: {title: '工作简报'},
          component: resolve => require(['@/views/smart/workBriefing/index'], resolve),
        },
        {
          path: 'workBriefingSummary',
          name: 'WorkBriefingSummary',
          meta: {title: '小结'},
          component: resolve => require(['@/views/smart/workBriefing/summary/index'], resolve),
        },
        {
          path: 'workBriefingDetailsWeek',
          name: 'WorkBriefingDetailsWeek',
          meta: {title: '本周详情'},
          component: resolve => require(['@/views/smart/workBriefing/details/week'], resolve),
        },
        {
          path: 'workBriefingDetailsMonth',
          name: 'WorkBriefingDetailsMonth',
          meta: {title: '本月详情'},
          component: resolve => require(['@/views/smart/workBriefing/details/month'], resolve),
        },
        {
          path: 'gantt',
          name: 'Gantt',
          meta: {title: '甘特图'},
          component: resolve => require(['@/views/smart/gantt/index'], resolve),
        },
      ]
    },
    {
      path: '/workingCircle',
      name: 'WorkingCircle',
      meta: {title: '工作圈'},
      component: resolve => require(['@/views/workingCircle/index'], resolve),
      children: [
        {
          path: '/',
          redirect: '/workingCircle/workingCircleProject',
        },
        {
          path: 'workingCircleProject',
          name: 'WorkingCircleProject',
          meta: {title: '工作圈-单个项目'},
          component: resolve => require(['@/views/workingCircle/project/index'], resolve),
        },
      ]
    },
    {
      path: '/notify',
      name: 'Notify',
      meta: {title: '消息通知'},
      component: resolve => require(['@/views/notify/index'], resolve),
      children: [
        {
          path: '/',
          redirect: '/notify/systemNotify',
        },
        {
          path: 'systemNotify',
          name: 'SystemNotify',
          meta: {title: '系统通知'},
          component: resolve => require(['@/views/notify/system/index'], resolve),
        },
        {
          path: 'taskNotify',
          name: 'TaskNotify',
          meta: {title: '任务提醒'},
          component: resolve => require(['@/views/notify/task/index'], resolve),
        },
        {
          path: 'workNotify',
          name: 'WorkNotify',
          meta: {title: '工作简报'},
          component: resolve => require(['@/views/notify/work/index'], resolve),
        },
        {
          path: 'endNotify',
          name: 'EndNotify',
          meta: {title: '完结通知'},
          component: resolve => require(['@/views/notify/end/index'], resolve),
        },
      ]
    }, {
      path: '/ht',
      name: 'Ht',
      meta: {title: '设置'},
      component: resolve => require(['@/views/ht/index'], resolve),
      children:[
        {
          path: '/',
          redirect: '/ht/memberManagement',
        },
        {
          path: 'memberManagement',
          name: 'memberManagement',
          meta: {title: '成员管理'},
          component: resolve => require(['@/views/ht/memberManagement/index'], resolve),
        },
        {
          path: 'administratorManagement',
          name: 'administratorManagement',
          meta: {title: '管理员管理'},
          component: resolve => require(['@/views/ht/administratorManagement/index'], resolve),
        },
        {
          path: 'comprehensiveSetup',
          name: 'comprehensiveSetup',
          meta: {title: '综合设置'},
          component: resolve => require(['@/views/ht/comprehensiveSetup/index'], resolve),
        },
        {
          path: 'enterpriseTemplate',
          name: 'enterpriseTemplate',
          meta: {title: '企业模板'},
          component: resolve => require(['@/views/ht/enterpriseTemplate/index'], resolve),
        },
        {
          path: 'myTemplate',
          name: 'myTemplate',
          meta: {title: '我的模板'},
          component: resolve => require(['@/views/ht/myTemplate/index'], resolve),
        },
      ]
    }
  ]
})
